import { WIN_MAIN_RENDERER_EVENT_NAME } from '@common/ipcNames';
import { mainHandle } from '@common/mainIpc';
const fs = require('fs');

export default () => {
  //获取文件大小
  mainHandle<any>(WIN_MAIN_RENDERER_EVENT_NAME.getFileSize, async (data: any) => {
    try {
      const state = fs.statSync(data.params.fileName);
      return state.size;
    } catch (err) {
      console.log(err);
    }
  });
};
